<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
                            <i class="fa  fa-fw fa-reorder"></i>  课程列表
                       </li>
                    </ol>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                <a class="btn btn-success" href="/admin_courseseries/edit?id=<?=$pCId?>">返回</a>
                    <label class="label-self"><span class="color-blue"></span></label>
                </div>
                <div class="col-md-6">
                    
                <form method="post" action="/admin_courseseries/addcourse?cs_id=<?=$pCId?>">
                        <div class="form-group input-group">
                        <input type="text" placeholder="输入课程标题或简介关键词搜索" name="key" class="form-control" value="<?=$pKey?>">
                            <span class="input-group-btn">
                              <button type="button" class="btn btn-default" id="search"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>
                </div>
                </div>
            </div>

            <div class="panel-body text-center">
                <table class="table table-hover" id="sample-table-1">
                    <thead>
                        <tr>
                            <td>编号</td>
                            <td>课程标题</td>
                            <td>课程类别</td>
                            <td>封面图片</td>
                            <td>讲师</td>
                            <td>课程简介</td>
                            <td>创建时间</td>
                            <td>播放次数</td>
                            <td>操作</td>
                        </tr>
                    </thead>
                    <?foreach($tDatas as $tRow){?>
                    <tr>
                        <td class="id"><?=$tRow['id']?></td>
                        <td><?=$tRow['title']?></td>
                        <td><?=$tRow['cate_name']?></td>
                        <td class="center slt"><img src="<?=$tRow['img']?>" alt="image"/></td>
                        <td><?=$tRow['lecturer_name']?></td>
                        <td><?=$tRow['descriptions']?></td>
                        <td><?=date('Y-m-d H:i',$tRow['created'])?></td>
                        <td><?=$tRow['complete']?></td>
                        <td>
                            <div class="visible-md visible-lg hidden-sm hidden-xs">
                           <?if(!empty($tRow['status'])){?><a class="add btn btn-green btn-xs tooltips" class="addCourse" data-placement="top"  data="<?=$tRow['id']?>" data-original-title="添加课程"><i class="fa fa-plus"></i></a>
                            <?}else{?><a class="btn btn-gray">已添加</a><?}?>
                            </div>
                            <div class="visible-xs visible-sm hidden-md hidden-lg">
                                <div class="btn-group">
                                    <a class="btn btn-green dropdown-toggle btn-sm" data-toggle="dropdown" href="#">
                                        <i class="fa fa-cog"></i> <span class="caret"></span>
                                    </a>
                                    <ul role="menu" class="dropdown-menu pull-right dropdown-dark">
                                        <li>
                                        <a role="menuitem" tabindex="-1" href="#" class="btn btn-success">
                                                <i class="fa fa-times"></i>添加课程
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
<?}?>
                </table>
                <?=$tShow?>
            </div>
        </div>
        <div class="subviews">
            <div class="subviews-container"></div>
        </div>
    </div>
    <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
<script>
$(function(){
        //单选
    $('.add').click(function(){
        var id = $(this).attr('data');
        var cs_id = <?=$pCId?>;
        $.post('/admin_courseseries/addcourse',{course_id:id,cs_id:cs_id},function(obj){
                alert(obj.msg);window.location.href= '/admin_courseseries/addcourse?cs_id=<?=$pCId?>';
        });
    });
});
$('#search').click(function(){
    $('form').submit();
});
</script>
<?php include PATH_TPL."/admin/tpl.footer.phtml"?>
